<template>
	<view class="container">
		<!--screen-->
		<view class="tui-header-screen" >
			<view class="tui-screen-top">
				<view class="tui-top-item tui-icon-ml" :class="[tabIndex == 0 ? 'tui-active tui-bold' : '']" data-index="0" @tap="screen">
					<view>DT通证</view>
					<tui-icon
						:name="tabIndex == 0 && order == 'asc' ? 'arrowup' : 'arrowdown'"
						:size="14"
						:color="tabIndex == 0 ? '#007AFF' : '#444'"
						tui-icon-class="tui-ml"
					></tui-icon>
				</view>
				<view class="tui-top-item" :class="[tabIndex == 1 ? 'tui-active tui-bold' : '']" @tap="screen" data-index="1">
					匹配数量
					<tui-icon
						:name="tabIndex == 1 && order == 'asc' ? 'arrowup' : 'arrowdown'"
						:size="14"
						:color="tabIndex == 1 ? '#007AFF' : '#444'"
						tui-icon-class="tui-ml"
					></tui-icon>
				</view>
				<view class="tui-top-item" :class="[tabIndex == 2 ? 'tui-active tui-bold' : '']" @tap="screen" data-index="2">
					记录时间
					<tui-icon
						:name="tabIndex == 2 && order == 'asc' ? 'arrowup' : 'arrowdown'"
						:size="14"
						:color="tabIndex == 2 ? '#007AFF' : '#444'"
						tui-icon-class="tui-ml"
					></tui-icon>
				</view>
			<!-- 	<view v-if="!is_fx" class="tui-top-item tui-icon-ml" @tap="screen" data-index="3">
					<text>筛选</text>
					<tui-icon name="screen" :size="12" color="#333" tui-icon-class="tui-ml" :bold="true"></tui-icon>
				</view> -->
			</view>
		</view>
		<!--screen-->

	

		<!--list-->
		
		<view class="tui-product-list">
			<view class="tui-product-container ">
			
				<s-pull-scroll ref="pullScroll" top="40"  :fixed="true"  :pullDown="pullDown" :pullUp="loadData" finishText="我也是有底线的">
					<!--商品列表-->
					<block v-for="(item, index) in datalist" :key="index" >
						<view class="flist_cont clearfix" @click="openbuy(item.uiId)">
							<view class="fl fimage"><image src="../../static/icon/been.png" class="fimage_item" /></view>
							<view class="fl financial_wrap">
								<view class="financial_cont clearfix">
									<view class="financial_info fl">
										<view class="finfo_title" :style="item.uiSQShenyuJiner >0 ? 'color:red': ''">待匹配:{{ item.uiSQShenyuJiner }}</view>
										<view class="finfo_time">{{ item.uiDate }}</view>
									</view>
									<view class="fr">
										<text class="price_num">{{ item. uiUJiner }}</text>
									</view>
								</view>
							</view>
						</view>
					</block>
				</s-pull-scroll>
			</view>
		</view>


		<!--list-->

		<!--左抽屉弹层 筛选 -->
		<tui-drawer mode="right" :visible="drawer" @close="closeDrawer">
			<view class="tui-drawer-box">
				<scroll-view class="tui-drawer-scroll" scroll-y :style="{ height: drawerH + 'px' }">
					<view class="search_box clearfix">
						<view class="tui-attr-item fl" style="width: 60%;"><input class="tui-attr-ellipsis search_box_input" placeholder="请输入要搜索的内容" /></view>
					</view>
			
					<view class="tui-safearea-bottom"></view>
				</scroll-view>
				<view class="tui-attr-btnbox">
					<view class="tui-attr-safearea">
						<view class="tui-drawer-btn tui-drawerbtn-black" hover-class="tui-white-hover" :hover-stay-time="150" @click="reset_choose">重置</view>
						<view class="tui-drawer-btn tui-drawerbtn-primary" hover-class="tui-red-hover" :hover-stay-time="150" @tap="closeDrawer">确定</view>
					</view>
				</view>
			</view>
		</tui-drawer>
		<!--左抽屉弹层 筛选-->

	
	</view>
</template>

<script>
import tuiIcon from '@/components/icon/icon';
import tuiDrawer from '@/components/drawer/drawer';
import tuiLoadmore from '@/components/loadmore/loadmore';
import tuiNomore from '@/components/nomore/nomore';
import tuiTopDropdown from '@/components/top-dropdown/top-dropdown';
import xianshi from '@/components/qy/xianshi';

import xflSelect from '../../components/xfl-select/xfl-select.vue';
import sPullScroll from '@/components/s-pull-scroll/index.vue';
export default {
	components: {
		tuiIcon,
		tuiDrawer,
		tuiLoadmore,
		tuiNomore,
		tuiTopDropdown,
		xflSelect,
		sPullScroll
		
	},
	data() {
		return {
			is_fx: false,
			currentId: 0,
			current_children_id: 0,
			flist: [],
			width: 200, //header宽度


			tabIndex: 2, //顶部筛选索引

			drawer: false,
			drawerH: 0, //抽屉内部scrollview高度


			datalist: [],

			loadding: false,
			sid: '',
		
		

			orderfield: '',
			order: 'desc'
		};
	},
	mounted() {this.refresh();},
	onLoad: function(options) {
		let obj = {};
		// #ifdef MP-WEIXIN
		obj = wx.getMenuButtonBoundingClientRect();
		// #endif
		// #ifdef MP-BAIDU
		obj = swan.getMenuButtonBoundingClientRect();
		// #endif
		// #ifdef MP-ALIPAY
		my.hideAddToDesktopMenu();
		// #endif
		uni.getSystemInfo({
			success: res => {
				this.width = obj.left || res.windowWidth;
				this.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44;
				this.drawerH = res.windowHeight - uni.upx2px(100) - this.height;
			}
		});
	
		
		
	},
	methods: {
		closeDrawer() {
			let sid = this.sid ? this.sid : 0;

			this.drawer = false;
			this.sid = '';
		},

		screen: function(e) {
			let index = e.currentTarget.dataset.index;
			
			if(index == this.tabIndex)
				this.order = this.order == "asc" ? "desc":"asc"
			
			if (index == 0) {
				this.tabIndex = 0;
			this.orderfield = "uiUJiner"
			} else if (index == 1) {
				this.tabIndex = 1;
				this.orderfield = "uiSQShenyuJiner"
			} else if (index == 2) {
				this.tabIndex = 2;
				this.orderfield = "uiDate"
			} else if (index == 3) {
				this.drawer = true;
			}
			
			if(index != 3)
				this.refresh();//获取列表
		
		},
		reset_choose() {
			this.currentId = 0;
			this.current_children_id = 0;
		},
		refresh: function() {
			this.$nextTick(() => {
				this.$refs.pullScroll.refresh();
			});
		},
		pullDown: function(pullScroll) {
			this.getListData(pullScroll);
		},
		loadData: function(pullScroll) {
		
			this.getListData(pullScroll);
		},
		getListData: function(pullScroll) {
			//mode 1代表下一页 0代表刷新
			//console.log(pullScroll.page);

		
		
			if (pullScroll.page == 1) {
				this.datalist = [];
			}

	
			this.$api.http
				.get('assistance/tradinghall/wantInvestLists', {
					page: pullScroll.page,
					orderfield: this.orderfield,
					order: this.order
				})
				.then(res => {
					this.callbackapi(res.data, pullScroll);
						pullScroll.success();
				});
		},
		callbackapi: function(data, pullScroll) {
			for (var i = 0; i < data.length; i++) {
				this.datalist.push(data[i]);
			}

			if (data.length == 0) {
				if (pullScroll.page == 1) {
					pullScroll.empty();
				} else {
					pullScroll.finish(true);
				}
			}
			
		},
		
		openbuy: function(id){
			uni.navigateTo({
				url: 'bussiness?id=' + id
			});
		}
	}
};
</script>

<style scoped>
page {
	background: #f7f7f7;
}
.clearfix {
	zoom: 1;
	display: block;
}

.clearfix:after {
	content: ".";
	visibility: hidden;
	display: block;
	height: 0;
	clear: both;
}

.fl {
	float: left;
}
.fr {
	float: right;
}
.status_bar {
	height: var(--status-bar-height);
	width: 100%;
	background-color: #ffffff;
}
.uni-navbar--border {
	border-bottom-color: #ffffff !important;
}
.show-box {
	height: 60upx !important;
	border: none;
	padding: 0 0 0 10upx !important;
}
.show-box .list-container .list .item {
	padding: 0 0 0 10upx !important;
}
.myselect {
	display: block;
}
.myselect .uni-input-wrapper input {
	font-size: 24upx !important;
	font-weight: bold;
}
.search_box {
	padding: 16upx 30upx 30upx 30upx;
}
.search_box_input {
}
.container {
	padding-bottom: env(safe-area-inset-bottom);
}

/* 隐藏scroll-view滚动条*/

::-webkit-scrollbar {
	width: 0;
	height: 0;
	color: transparent;
}

/*screen*/

.tui-header-screen {
	width: 100%;
	box-sizing: border-box;
	background: #fff;
	position: fixed;
	z-index: 1000;

}


.tui-screen-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 28rpx;
	color: #333;
	
	position: relative;
	background: #fff;
	height: 50rpx;
}



.tui-top-item {
	height: 38rpx;
	line-height: 38rpx;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tui-topitem-active {
	color: #007aff;
}

.tui-btmItem-active {
	background: #fcedea !important;
	color: #007aff;
	font-weight: bold;
	position: relative;
}

.tui-btmItem-active::after {
	content: '';
	position: absolute;
	border: 1rpx solid #007aff;
	width: 100%;
	height: 100%;
	border-radius: 40rpx;
	left: 0;
	top: 0;
}


.tui-bold {
	font-weight: bold;
}

.tui-active {
	color: #007aff;
}

.tui-icon-ml .tui-icon-class {
	margin-left: 6rpx;
}

.tui-ml {
	margin-left: 6rpx;
}

.tui-seizeaseat-20 {
	height: 20rpx;
}

.tui-seizeaseat-30 {
	height: 30rpx;
}

.tui-icon-middle .tui-icon-class {
	vertical-align: middle;
}

.tui-middle {
	vertical-align: middle;
}

/*screen*/

/*顶部下拉选择 属性*/

.tui-scroll-box {
	width: 100%;
	height: 480rpx;
	box-sizing: border-box;
	position: relative;
	z-index: 99;
	color: #fff;
	font-size: 30rpx;
	word-break: break-all;
}

.tui-drop-item {
	color: #333;
	height: 80rpx;
	font-size: 28rpx;
	padding: 20rpx 40rpx 20rpx 40rpx;
	box-sizing: border-box;
	display: inline-block;
	width: 50%;
}

.tui-drop-btnbox {
	width: 100%;
	height: 100rpx;
	position: absolute;
	left: 0;
	bottom: 0;
	box-sizing: border-box;
	display: flex;
}

.tui-drop-btn {
	width: 50%;
	font-size: 32rpx;
	text-align: center;
	height: 100rpx;
	line-height: 100rpx;
	border: 0;
}

.tui-btn-red {
	background: #007aff;
	color: #fff;
}

.tui-red-hover {
	background: #c51a15 !important;
	color: #e5e5e5;
}

.tui-btn-white {
	background: #fff;
	color: #333;
}

.tui-white-hover {
	background: #e5e5e5;
	color: #2e2e2e;
}

/*顶部下拉选择 属性*/

/*顶部下拉选择 综合*/

.tui-dropdownlist {
	width: 100%;
	position: absolute;
	background: #fff;
	border-bottom-left-radius: 24rpx;
	border-bottom-right-radius: 24rpx;
	overflow: hidden;
	box-sizing: border-box;
	padding-top: 10rpx;
	padding-bottom: 26rpx;
	left: 0;

	visibility: hidden;
	transition: all 0.2s ease-in-out;
	z-index: 999;
}

.tui-dropdownlist-show {
	visibility: visible;
}

.tui-dropdownlist-mask {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.6);
	z-index: -1;
	transition: all 0.2s ease-in-out;
	opacity: 0;
	visibility: hidden;
}

.tui-mask-show {
	opacity: 1;
	visibility: visible;
}

.tui-dropdownlist-item {
	color: #333;
	height: 70rpx;
	font-size: 28rpx;
	padding: 0 40rpx;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

/*顶部下拉选择 综合*/

.tui-drawer-box {
	width: 686rpx;
	font-size: 24rpx;
	overflow: hidden;
	position: relative;
	padding-bottom: 100rpx;
}

.tui-drawer-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 30rpx;
	box-sizing: border-box;
	height: 80rpx;
}

.tui-title-bold {
	font-size: 26rpx;
	font-weight: bold;
	flex-shrink: 0;
}

.tui-location {
	margin-right: 6rpx;
}

.tui-attr-right {
	width: 70%;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-align: right;
}

.tui-all-box {
	width: 90%;
	white-space: nowrap;
	display: flex;
	align-items: center;
	justify-content: flex-end;
}

.tui-drawer-content {
	padding: 16rpx 30rpx 30rpx 30rpx;
	display: flex;
	align-items: center;
	justify-content: space-between;
	box-sizing: border-box;
}

.tui-input {
	border: 0;
	height: 64rpx;
	border-radius: 32rpx;
	width: 45%;
	background: #f7f7f7;
	text-align: center;
	font-size: 24rpx;
	color: #333;
}

.tui-phcolor {
	text-align: center;
	color: #b2b2b2;
	font-size: 24rpx;
}

.tui-flex-attr {
	flex-wrap: wrap;
	justify-content: flex-start;
}

.tui-attr-item {
	width: 30%;
	height: 64rpx;
	background: #f7f7f7;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4rpx;
	box-sizing: border-box;
	border-radius: 32rpx;
	margin-right: 5%;
	margin-bottom: 5%;
}

.tui-attr-ellipsis {
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
	width: 96%;
	text-align: center;
}

.tui-attr-item:nth-of-type(3n) {
	margin-right: 0%;
}

.tui-attr-btnbox {
	width: 100%;
	position: absolute;
	left: 0;
	bottom: 0;
	box-sizing: border-box;
	padding: 0 30rpx;
	background: #fff;
}

.tui-attr-safearea {
	height: 100rpx;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-bottom: env(safe-area-inset-bottom);
}

.tui-safearea-bottom {
	width: 100%;
	height: env(safe-area-inset-bottom);
}

.tui-attr-btnbox::before {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	border-top: 1rpx solid #eaeef1;
	-webkit-transform: scaleY(0.5);
	transform: scaleY(0.5);
}

.tui-drawer-btn {
	width: 47%;
	text-align: center;
	height: 60rpx;
	border-radius: 30rpx;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
}

.tui-drawerbtn-black {
	border: 1rpx solid #555;
}

.tui-drawerbtn-primary {
	background: #007aff;
	color: #fff;
}

/* 商品列表*/
.tui-product-list {
	display: flex;
	justify-content: space-between;
	flex-direction: row;
	flex-wrap: wrap;
	box-sizing: border-box;
}
.tui-product-container {
	display: flex;
	flex-wrap: wrap;
	flex: 1;
	padding: 0 20upx;
}

.tui-product-container:last-child {
	margin-right: 0;
}



.been_icon {
	width: 30upx;
	height: 30upx;
	vertical-align: middle;
}

.flist_cont {
	width: 100%;
	background: #ffffff;
	padding: 20upx;
	border-radius: 10upx;
	border-left: 10upx solid #007aff;
	margin-top: 20upx;
	height: 156upx;
}
.flist_cont:first-child {
	margin-top: 0upx;
}
.fimage {
	width: 16%;
	height: 100upx;
	text-align: center;
	margin-top: 10upx;
}
.fimage .fimage_item {
	width: 100upx;
	height: 100upx;
}
.financial_wrap {
	width: 84%;
	font-size: 28upx;
	padding: 0 10upx 0 28upx;
	color: #000000;
	line-height: 40upx;
}
.finfo_title {
}
.finfo_time {
	color: #666;
	font-size: 24upx;
}
.finfo_desc {
	font-size: 24upx;
	color: #A7A7A7;
}
.price_num {
	font-size: 42upx;
	line-height: 100upx;
	font-weight: bold;
	color: #0a98d5;
}

.price_fnum {
	font-size: 42upx;
	line-height: 100upx;
	font-weight: bold;
	color:#19BE6B;
}

.financial_info{
	
	padding-top: 20upx;
	
}
/* 商品列表*/
</style>
